a, b, n, q = 0, 0, 0, 0
maxn = 200007
x = [0]*maxn
tree = x*4
def sum(a, b):
    a += n
    b += n
    s = 0
    while a<=b:
        if a%2 == 1:
            s += tree[a]
            a += 1
        if b%2 == 0:
            s += tree[b]
            b -= 1
        a //= 2
        b //= 2
    return s
def add(k, x):
    k += n
    tree[k] += x
    k //= 2
    while k >= 1:
        tree[k] = tree[k<<1] + tree[(k<<1)+1]
        k //= 2
    return

n, q = map(int, input().strip().split(' '))
#  for i in range(1, n+1):
#      x[i] = int(input())
x = [0]+list(map(int, input().strip().split(' ')))
#  print(x)
for _ in range(q):
    t, a, b = map(int, input().strip().split(' '))
    if t==1:
        diff = b - x[a]
        add(a, diff)
    else:
        print(sum(a, b))
